import java.util.ArrayList;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        //Scanner in = new Scanner(System.in);
        Scanner in=new Scanner(System.in);
        while(in.hasNextInt()){
                String string = in.nextLine();
                System.out.println(sum(string));

        }
    }
    public static int sum(String s){
        int  sum = 0;
        int sub = 0;
        int start=0;
        int end =0;
        char c = s.charAt(start);

        ArrayList<String> list= new ArrayList<>();
        while(true){
            if (c == s.charAt(end)){
                end++;
            }
            else {
                list.add(s.substring(start,end));
                start = end;
                c=s.charAt(start);
            }
            if(end ==s.length()){
                list.add(s.substring(start,end));
                break;
            }
        }
        for (String S : list){
            if (S.length() == 1){
                sum++;
            }else{
                sub =S.length();
                sum+=sub*(sub+1)/2;
            }
        }
        return sum;
    }
}
